<template>
  <el-dialog
    title="停止原因详情"
    :visible.sync="visible"
    width="60%"
    append-to-body
  >
    <avue-form
      ref="form"
      v-model="form"
      :option="cloudStopReason"
    ></avue-form>
  </el-dialog>
</template>
<script>
import { cloudStopReason } from '@/const/crud/pet/cloudAdoptOrder';
import { getManualStopReason } from '@/api/core/adopt';
export default {
  props: {
    value: {
      type: Boolean,
      default: false,
    },
    orderCode: {
      type: String,
    },
  },
  data() {
    return {
      cloudStopReason,
      form: {},
    };
  },
  computed: {
    visible: {
      get() {
        return this.value;
      },
      set(val) {
        this.$emit('input', val);
      },
    },
  },
  watch: {
    visible(val) {
      if (val) {
        this.getDetail();
      }
    },
  },
  methods: {
    getDetail() {
      getManualStopReason(this.orderCode).then((res) => {
        if (res.data.code === 0) {
          this.form = res.data.data;
        }
      });
    },
  },
};
</script>
